package com.lagou.rpc.consumer.Controller;

import com.lagou.rpc.api.IUserService;
import com.lagou.rpc.consumer.proxy.RpcClientProxy;
import com.lagou.rpc.pojo.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {


    private IUserService userService = (IUserService) RpcClientProxy.createProxy(IUserService.class);

    @RequestMapping("/get")
    public User getUser(Integer id) {

//        System.out.println("id = " + id);
        User user = userService.getById(id);
        System.out.println(user);

        return user;
    }
}
